<script src="/assets/libs/jquery/dist/jquery.js"></script>
<script src="/mobile/js/jquery.cxselect.js"></script>
<div class="panel panel-default panel-intro">{:build_heading()}
    <?php
     use app\admin\model\halt\Cate;
function getName($name){
        if (empty($name))return;
        $arr = explode(",",$name);
        $model = new Cate();
        $str=array();
        foreach ($arr as $v){
            $info = $model->field('name')->find($v);
    if ($info){
    $str[]=$info['name'];
    }
    }
    return implode(',',$str);
    }
    ?>
    <div class="panel-body">
        <div id="myTabContent" class="tab-content">
            <div class="tab-pane fade active in" id="one">
                <div class="widget-body no-padding">
                    <div class="bootstrap-table">
                        <div class="">
                            <form  class="form-horizontal nice-validator n-default" method="get" action="" novalidate="novalidate">

                                <div class="form-group">
                                    <label class="control-label col-xs-12 col-sm-2" style="float: left;">{:__('Cname')}:</label>
                                    <div class="col-xs-12 col-sm-12">
                                        <input id="c-cname" value="{$cname}" class="form-control form-control" name="cname" type="text">
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="control-label col-xs-12 col-sm-12"  style="float: left;">{:__('Classif')}:</label>
                                    <div class="col-xs-12 col-sm-12">

                                        <div class="form-inline" data-toggle="cxselect" data-name="name" data-selects="first,second,three">
                                            <select class="first form-control" style="width:120px"  name="first"  data-url="/admin/ajax/housecate?type=1&amp;pid=0">
                                            <?php
                                                if(isset($cx['first']) && $cx['first']!=''){
                                            ?>
                                                <option value="<?php echo $cx['first'];?>"></option>
                                                <?php }?>
                                           
                                            </select>
                                            <select class="second form-control" style="width:120px"   name="second" data-url="/admin/ajax/housecate?type=1" data-query-name="pid">
                                                <?php
                                                if(isset($cx['second']) && $cx['second']!=''){
                                            ?>
                                                <option value="<?php echo $cx['second'];?>"></option>
                                                <?php }?>


                                            </select>
                                            <select class="three form-control"  style="width:120px" name="three"  data-url="/admin/ajax/housecate?type=1" data-query-name="pid">
                                                <?php
                                                if(isset($cx['three']) && $cx['three']!=''){
                                            ?>
                                                <option value="<?php echo $cx['three'];?>"></option>
                                                <?php }?>

                                            </select>

                                        </div>


                                    </div>
                                </div>



                                <div class="form-group layer-footer">
                                    <label class="control-label col-xs-12 col-sm-2"></label>
                                    <div class="col-xs-12 col-sm-8">
                                        <button type="submit" class="btn btn-success">{:__('OK')}</button>
                                    </div>
                                </div>
                            </form>

                        </div>




                    </div>
                    <div class="fixed-table-container" style="padding-bottom: 0px;">
                        <div class="fixed-table-header" style="display: none;">
                            <table></table>
                        </div>
                        <div class="fixed-table-body">
                            <div class="fixed-table-loading" style="top: 42px; display: none;">正在努力地加载数据中，请稍候……</div>
                            <table id="table" class="table  table-bordered " data-operate-edit="1" data-operate-del="1" width="100%">
                                <thead>
                                <tr>


                                    <th style="text-align: center; vertical-align: middle; " data-field="cname">
                                        <div class="th-inner ">产品名称</div>
                                        <div class="fht-cell"></div>
                                    </th>




                                    <th style="text-align: center; vertical-align: middle; " data-field="ctime">
                                        <div class="th-inner ">操作</div>
                                        <div class="fht-cell"></div>
                                    </th>

                                </tr>
                                </thead>
                                <tbody data-listidx="0">
                                {notempty name="list"}

                                {volist name="list" id="vo"}

                                <tr id="c{$vo.id}">
                                    <td style="text-align: center; vertical-align: middle; ">{$vo.cname}</td>

                                    <td style="text-align: center; vertical-align: middle; ">
                                        <a style="cursor: pointer" class="btn btn-xs btn-success btn-editone" onclick="haha({$vo.id},'{$vo.cname}','<?php echo getName($vo['class_text']);?>',this,'{$vo['storenum']}')"  ><i class="fa fa-plus"></i></a>
                                    </td>


                                </tr>
                                {/volist}
                                {/notempty}

                                </tbody>
                            </table>
                        </div>

                        <div class="fixed-table-pagination" style="display: block;">
                            <div class="pull-left pagination-detail">

                                {$list->render()}

                            </div>
                        </div>



                    </div>
                </div>
                <div class="clearfix"></div>
            </div>
        </div>
    </div>
</div>
</div>
<script>
    $.cxSelect.defaults.jsonName = 'name';
    $.cxSelect.defaults.jsonValue = 'value';
    $.cxSelect.defaults.jsonSpace = 'data';

    $("[data-toggle='cxselect']").cxSelect();
</script>